package cn.usian.service.impl;

import cn.usian.mapper.StudentMapper;
import cn.usian.pojo.Student;
import cn.usian.service.StudentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service

public class StudentServiceImpl implements StudentService {

    @Resource
    private StudentMapper studentMapper;

    /**
     *查询
     * @return
     */
    @Override
    public List<Student> findAll() {
        return studentMapper.selectList(null);
    }

    /**
     * 添加
     * @param student
     */
    @Override
    public void add(Student student) {
        studentMapper.insert(student);
    }

    /**
     * 删除
     * @param uid
     */
    @Override
    public void delete(Integer uid) {
        studentMapper.deleteById(uid);
    }

    /**
     * 修改回显
     * @return
     * @param uid
     */
    @Override
    public Student findByUid(Integer uid) {
        return studentMapper.selectById(uid);
    }

    /**
     * 修改
     * @param student
     */
    @Override
    public void update(Student student) {
    studentMapper.updateById(student);
    }

    @Override
    public Student findStudentAndPwd(Student student) {
        return studentMapper.findStudentAndPwd(student);
    }
}
